package cn.idietrade.idietradegoodsmodule8002.controller;

import cn.idietrade.common.utils.EmptyUtils;
import cn.idietrade.common.utils.ReturnResultData;
import cn.idietrade.idietradegoodsmodule8002.service.goodsservice.GoodsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 作者
 * @createTime 2022/11/30 16:33
 * @description 描述
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Resource
    private GoodsService goodsService;

    //根据城市id查询商品
    @RequestMapping("/cityGoodsShouw")
    public ReturnResultData getCityGoods(String token,Integer cid){
        ReturnResultData resultData = new ReturnResultData();
        if(EmptyUtils.isEmpty(token)){ //未登录
            resultData.setMessage("当前未登录，请前往登录页面");
            resultData.setData(null);
            resultData.setCode(-2);
        }else{
            return goodsService.goodsCity(cid);
        }
        return resultData;
    }
}
